<head>
<style>
td.type{font-size:10px;font-weight:bold;}
th.{text-align:center}
</style>
</head>
<?PHP
if(isset($_POST['type']) && $_POST['type']!="")
{
if($_POST['type']=="short" && isset($_POST['sin']) && $_POST['sin'] != '')
{
	$sou = exec('/usr/bin/perl ./kwHashCount.pl \''.iconv('utf8','gbk',$_POST['sin']).'\'');
	if(preg_match("/(\d*)$/", $sou, $matches))
	{
		error_log($matches[0]);
		$sou = $matches[1];
	}
}
elseif($_POST['type']=="long" && isset($_POST['lin']) && $_POST['lin'] != '')
{
	$lou = exec('./getHash '.$_POST['lin']);
	$lou = trim($lou);
}
}
?>
<p>关键词Hash计算for KGB</p>
<table width=90% style="position:relative;top:5px;">
<tr>
<th width=40% >Type</th>
<th width=45% >Input</th>
<th width=15% >Output</th>
</tr>
<tr>
<td class="type" >Short (for hash split)</td>
<form action="getHashShort.php" method="POST" ><td><input type="hidden" name="type" value="short" /><input style="width:100%" type=text id="sin" name="sin" onkeydown="this.submit();" /></td></form>
<td>
<?PHP
if(isset($sou))
    echo '<span><input name="" value="'.$sou.'" /></span>';
else
    echo '<input name="" value="" />';
?>
</td>
</tr>
<tr>
<td class="type" >Long (for QueryEngine hash calculate)</td>
<form action="getHashShort.php" method="POST" ><td><input type="hidden" name="type" value="long" /><input style="width:100%" type=text id="lin" name="lin" onkeydown="this.submit();" /></td></form>
<td>
<?PHP
if(isset($lou))
    echo '<span><input name="" value="'.$lou.'" /></span>';
else
    echo '<input name="" value="" />';
?>
</td>
</tr>
</table>
